export function formatTimeStamp(timestamp) {
  const now = Date.now();
  const diff = now - timestamp;
  
  if (diff < 60 * 1000) { // 1分钟内
    return `1分钟内`;
  } else if (diff < 60 * 60 * 1000) { // 1小时内
    return `${Math.floor(diff / 1000 / 60)}分钟`;
  } else if (diff < 24 * 60 * 60 * 1000) { // 1天内
    return `${Math.floor(diff / 1000 / 60 / 60)}小时`;
  } else if (diff < 30 * 24 * 60 * 60 * 1000) { // 1个月内
    return `${Math.floor(diff / 1000 / 60 / 60 / 24)}天`;
  } else if (diff < 90 * 24 * 60 * 60 * 1000) { // 3个月内
    return `${Math.floor(diff / 1000 / 60 / 60 / 24 / 30)}月`;
  } else {
    return null;
  }
}


export function gotoHome(){
	uni.showModal({
		title:'提示',
		content:'页面有误将返回首页',
		showCancel:false,
		success: (res) => {
			if(res.confirm){  //点了确认之后
				uni.reLaunch({
					url:'/pages/index/index'
				})
			}
		}
	})
}